#include "PrinterConverter.h"

void PrinterConverter::extractValuesFromCollector(int iterations, int sizeOfArray, std::vector<CollectResults> *collectors)
{
	line << "-----------------------------------------------" << std::endl;
	line << "Average time and speedup based on " << iterations << " times with "; 
	line << sizeOfArray << " array size." << std::endl;

	int index_collectors = 0;
	for(index_collectors = 0; index_collectors < collectors->size(); index_collectors++)
	{
		line << collectors->at(index_collectors).getDescription() << collectors->at(index_collectors).getAverage() << std::endl;
	}

	index_collectors = 0;
	while(index_collectors < collectors->size())
	{
		line << "Speedup: " << collectors->at(index_collectors).getName() << " and " << collectors->at(index_collectors+1).getName()
			<< " : " << (collectors->at(index_collectors+1).getAverage()/collectors->at(index_collectors).getAverage()) << std::endl;
		index_collectors += 2;
	}

	printer.insertLine(line.str());
}

void PrinterConverter::printToFile()
{
	printer.printToFile();
}

void PrinterConverter::printToScreen()
{
	printer.printToScreen();
}
